﻿using System;
using UnityEngine;
namespace AladdinGameFramework.UGUI
{
	[DisallowMultipleComponent]
	public class CUIWarpContentItem : MonoBehaviour
	{
		private int index;
		private CUIWarpContent warpContent;
		public CUIWarpContent WarpContent
		{
			set
			{
				this.warpContent = value;
			}
		}
		public int Index
		{
			get
			{
				return this.index;
			}
			set
			{
				this.index = value;
				base.transform.localPosition = this.warpContent.getLocalPositionByIndex(this.index);
				base.gameObject.name = ((this.index < 10) ? ("0" + this.index) : string.Concat(this.index));
				bool flag = this.warpContent.onInitializeItem != null && this.index >= 0;
				if (flag)
				{
					this.warpContent.onInitializeItem(base.gameObject, this.index);
				}
			}
		}
		private void OnDestroy()
		{
			this.warpContent = null;
		}
	}
}
